package leetcode_1101_1200;

public class LeeCode_1111 {
    public static void main(String[] args) {

    }
    private static int[] maxDepthAfterSplit(String seq) {
        char[] s = seq.toCharArray();
        int n = s.length;
        int[] ans = new int[n];
        int sta0 = 0, sta1 = 0;
        for (int i = 0; i < n; i++) {
            if (s[i] == '('){
                if (sta0 <= sta1){
                    sta0++;
                    ans[i] = 0;
                }else {
                    sta1++;
                    ans[i] = 1;
                }
            }else {
                if (sta0 >= sta1){
                    sta0--;
                    ans[i] = 0;
                }else {
                    sta1--;
                    ans[i] = 1;
                }
            }
        }
        return ans;
    }
}
